Conversation
a4e988b to
f5f38f2
Compare
4ea0953 to
b13558e
Compare
9cd3d26 to
979897b
Compare
Introduce the 'sess' R package for WebSocket IPC, implement terminal orchestration, and modernize the session watcher architecture for improved reliability and performance.
Add end-to-end integration tests for the session watcher and terminal, refactor existing unit tests, and update GitHub Action workflows for improved CI reliability.
Apply session watcher stability fixes, swap R IPC client/server roles for reliability, perform final linting, and bump the version to 3.0.0-rc.0.
* Fix `rstudioapi::documentContext()` to return the complete document context, including `contents`, `path`, and `selection`. * Fix `rstudioapi::documentPath()` by accessing the corrected document context structure. * Refactor viewer dispatching to remove hardcoded `viewer` arguments from JSON-RPC payloads. `webview`, `dataview`, `browser`, and `page_viewer` now explicitly define their intent and dynamically resolve against the VS Code `session.viewers.viewColumn` settings. * Ignore `*.d.ts` files in `.eslintignore` to fix linting errors.
|
Thanks for the good work! I'm wondering how to make it work with self-managed R sessions, e.g. a radian console started in a tmux window? |
|
I'm also wondering if the dependencies of |
If you run sess::sess_app("ws://......")(at the moment of writing, it may be more convenient to copy the whoe command with Theorietically, we could replace websocket with base R socketConnect but it is not very efficient. I beleive most users will also install languageserver, I guess it is also possible to absorb the package into langugeserver which is kind of bloated already. |
|
Yes, that's true. languageserver has many dependencies already. One difference is that languageserver is not loaded in the user session while sess is. For me, less packages loaded in user session could be cleaner :) |
There are a few things that are still not working (e.g. live share). It won't be merged anytime soon. The sess package is now bundled with the VSCode extension, we might move it to its own repository in the future.
Everything below this sentence was generated automatically.
🚀 Feature: Migrate Session Watcher to WebSockets & JSON-RPC 2.0
📝 Overview
This PR introduces a major architectural upgrade to vscode-R by replacing the legacy, file-based session watcher with a high-performance, token-authenticated IPC (Inter-Process Communication) mechanism.
The new system operates over a pure WebSocket architecture using JSON-RPC 2.0, enabling reliable, bidirectional communication between the R session and the VS Code extension.
✨ Key Changes
1. New
sessR Packagesesspackage to handle the server-side IPC.sess::register_hooks) andrstudioapiemulation.2. Client Session Manager Modernization
src/session.tsrefactored: Heavily refactored the extension's session manager to act as a JSON-RPC client/server.3. Viewer Architecture Overhaul
httpgdViewer.tsandstandardViewer.ts).helpViewerandwebViewerimplementations to cleanly integrate with the new IPC layer.4. Comprehensive Testing & CI Modernization
session.test.ts) and terminal (terminal.test.ts).main.yml,pre-release.yml,release.yml) to support the new testing architecture and package building steps.💡 Motivation & Background
The previous file-based session watcher (writing state to
.vscode-Rdirectories) was prone to race conditions, slow I/O, and was strictly one-way (R -> VS Code).By migrating to WebSockets and JSON-RPC 2.0:
🧪 Testing Performed
httpgdand standard viewers.rstudioapiemulation and global environment variable syncing.Note: Ensure to check any new dependencies introduced in
package.jsonandpackage-lock.jsonare properly installed before building.